// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 新增权限 POST /menu/add */
export async function insertMenuUsingPost(body: API.AuthorityVO, options?: { [key: string]: any }) {
  return request<API.TradeResult>('/menu/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除菜单 POST /menu/delete */
export async function deleteMenuUsingPost(body: string[], options?: { [key: string]: any }) {
  return request<API.TradeResult>('/menu/delete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 查询菜单清单，不分页 POST /menu/list */
export async function fetchMenuListUsingPost(options?: { [key: string]: any }) {
  return request<API.TradeResult>('/menu/list', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 查询角色对应的菜单树 GET /menu/tree/${param0} */
export async function fetchMenuTreeByRoleUsingGet(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.fetchMenuTreeByRoleUsingGETParams,
  options?: { [key: string]: any },
) {
  const { roleId: param0, ...queryParams } = params;
  return request<API.TradeResult>(`/menu/tree/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 修改权限 POST /menu/update */
export async function updateMenuUsingPost(body: API.AuthorityVO, options?: { [key: string]: any }) {
  return request<API.TradeResult>('/menu/update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
